const service = require('../service')
const msg = require('../util/ctx_body')

exports.login = async (ctx, next) => {
  let body = ctx.request.body;
  if (body.password === undefined || body.name === undefined) {
    msg.resultUtil(ctx, 300)
    return
  }
  if (body.password === '123456' && body.name === 'admin') {
    let token = 'AAAAAAAAAAAAAAAAAAAAAAAAAA'
    msg.resultUtil(ctx, 200, token)
  } else {
    msg.resultUtil(ctx, 400, null, '用户名或密码错误')
  }
}